package com.stefanini.pe.bbva.bp.in.dao.impl;

import java.util.HashMap;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Repository;

import com.ibatis.sqlmap.client.SqlMapClient;
import com.stefanini.pe.bbva.bp.in.dao.iface.ResumenGeneralDAOIface;
import com.stefanini.pe.bbva.bp.in.to.Combo;
import com.stefanini.pe.bbva.bp.in.to.ResumenGeneral;

@Repository
public class ResumenGeneralDAOImpl extends SqlMapClientDaoSupport implements ResumenGeneralDAOIface{

	@Autowired
	public ResumenGeneralDAOImpl(SqlMapClient sqlMapClient) {
		setSqlMapClient(sqlMapClient);
	}
	
	@SuppressWarnings("unchecked")
	public List<ResumenGeneral> consultaResumen(String anio) throws Exception{
		HashMap map = new HashMap();
		map.put("in_anio", anio);
		
		System.out.println("sp: IIAF.PIIAF_GESTION.sp_cons_gt_resumen, params: "+map);
		getSqlMapClientTemplate().queryForList("BP_RESUMEN_SqlMap.sp_resumenGeneral",map);
		return (List<ResumenGeneral>)map.get("out_result_set");	
	}
	
	@SuppressWarnings("unchecked")
	public List<Combo> listarAnio() throws Exception{
		HashMap map = new HashMap();
		getSqlMapClientTemplate().queryForList(
				"BP_RESUMEN_SqlMap.sp_cargaCombo", map);
		return (List<Combo>) map.get("out_result_set");
	}
}
